PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Save Option Constants

AppleScript defines the constants yes , no , and ask for use with the Close command. These constants are described in Table A-2.

The following script creates a new document, inserts some text into it, and closes the document, asking the user whether to save it.

tell application "AppleWorks"
    -- Create a new document and insert some previously gathered text.
    make new document at beginning with properties ¬
        {name:"New Report"}
    -- Create a selection and replace it with the gathered text.
    select text body of document "New Report"
    set selection of document "New Report" to myText
    close document "New Report" saving ask
end tell

The term saving ask means ask the user whether to save, while saving no means do not save any changes to the closed document and saving yes means save without asking.


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)